﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint.WebControls;

namespace Kiiro.SiteDefinition.ControlTemplates
{
    public partial class WMDEditor : KiiroUserControl
    {
        private SPControlMode displayMode = SPControlMode.Display;
        public SPControlMode DisplayMode
        {
            get { return displayMode; }
            set { displayMode = value; }
        }

        public string Markdown
        {
            get { return txtMarkdown.Text.Trim ( ); }
            set { txtMarkdown.Text = value.Trim(); }
        }

        public string Html
        {
            get { return txtHtml.Text.Trim ( ); }
            set { txtHtml.Text = value.Trim(); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if ( DisplayMode == SPControlMode.Display )
            {
                txtMarkdown.Visible = false;
                txtHtml.Visible = false;
                pnlPreview.Visible = false;
                pnlActions.Visible = false;
                litHtml.Text = Html;
            }
            //else if ( DisplayMode == SPControlMode.New || DisplayMode == SPControlMode.Edit )
            //{
            //    txtHtml.Attributes.CssStyle.Add ( "display", "none" );
            //}
        }
    }
}

/*************************************************************************
 * 
 * $Log: /Internal Projects/Kiiro/Kiiro.SiteDefinition/12/TEMPLATE/CONTROLTEMPLATES/Kiiro/WMDEditor.ascx.cs $
 * 
 * 4     1/15/10 9:14a Camerons
 * 
 * 3     1/14/10 12:46p Camerons
 * 
 **************************************************************************/